<?php use_helper('PA_Links') ?>
<?php if($handler): ?>
<script type="text/javascript">
  $(window).unload(function(){
    <?php echo "opener.App.Table.$handler()";?>
  });
  
<?php endif;  ?>
</script>
<div class="sComponentContainer">
  <div class="sComponent floatLeft">
    <p id="title">Użytkownicy</p>
    <table id="usersTable" style="display: inline-table">
      <th>Lp.</th>
      <th>Imię</th>
      <th>Nazwisko</th>
      <th>Login</th>
      <th>Hasło</th>
      <th>Email</th>
      <th>Rola</th>
      <th>Stanowisko</th>
      <th>Folder</th>
      <th>Edycja</th>
      <?php if($users): ?>
      <?php foreach($users as $user): ?>
      <tr>
        <td><p id="counter"></p></td>
        <td><?php echo $user->getFirstName() ?></td>
        <td><?php echo $user->getLastName() ?></td>
        <td><?php echo $user->getLogin() ?></td>
        <td><?php echo $user->getPassword() ?></td>
        <td><?php echo $user->getEmail() ?></td>
        <td><?php echo $user->getRole() ?></td>
        <td><?php echo $user->getPosition() ?></td>
        <td><?php echo $user->getDirectory() ?></td>
        <td nowrap="nowrap">
          <img src="/images/icons/change.png" class="middle" width="18" height="18"/>  <a onclick="App.Table.attachForm(this, '<?php echo link_to_app('Core', 'homeGetForm', array('form' => 'UserForm', 'form_action' => 'update', 'id' => $user->getId())) ?>', '#usersTable', 'updateUser', 8, 7, true)" class="middle">Zmień</a>
          <img src="/images/icons/delete.png" class="middle" width="18" height="18"/>  <a href="<?php echo link_to_app('Core', 'deleteUser', array('id' => $user->getId())) ?>" class="middle">Usuń</a>
        </td>
      </tr>
      <?php endforeach; ?>
      <?php endif; ?>
      <tr id="add">
        <td colspan="10"><img src="/images/icons/add.png" class="middle" width="18" height="18"/>  <a onclick="App.Table.attachForm(this, '<?php echo link_to_app('Core', 'homeGetForm', array('form' => 'UserForm', 'form_action' => 'create')) ?>', '#usersTable', 'createUser', 8, 7, true)" class="middle">Dodaj</a></td>
      </tr>
    </table>
  </div>
</div>
